﻿//using System.Linq;

//using System;

////class ExtensionMethods2
////{
////    public class Location
////    {
////        private string locationName;
////        private static string locationName_Static;

////        public Location(string name) => Name = name;

////        static Location() => locationName_Static = "22";

////        public  string Name
////        {
////            get => locationName;
////            set => locationName = value;
////        }
////    }
////    static void Main()
////    {
////        Location location =new Location("szq");

////        Console.ReadKey();
////    }
////}

////class program {

////    static void Main(String[] args) {

////        // Manager manager = new Manager();
////        // Manager manager = new Manager(1);

////        Manager manager = new Manager(1,2);

////    }
////}

////public class Manager : Employee {

////    public Manager(){

////	}
////    public Manager(int annualSalary)
////		:base(annualSalary)
////    {

////    }

////    public Manager(int weeklySalary, int numberOfWeeks)
////        : base(weeklySalary, numberOfWeeks)
////    {

////    }
////}
////public class Employee
////{
////    public int Salary;

////    public Employee() {
////    }

////    public Employee(int annualSalary)
////    {
////        Salary = annualSalary;
////    }

////    public Employee(int weeklySalary, int numberOfWeeks)
////    {
////        Salary = weeklySalary * numberOfWeeks;
////    }
////}

////----------------------------------------------实例构造函数（C# 编程指南）

////class Coords
////{
////    //public Coords()
////    //    : this(0, 0)
////    //{ }

////    public Coords():this(0,0)
////    { }

////    public Coords(int x, int y)
////    {
////        X = x;
////        Y = y;
////    }

////    public int X { get; set; }
////    public int Y { get; set; }

////    public override string ToString() => $"({X},{Y})";
////}

////class Example
////{
////    static void Main()
////    {
////        var p1 = new Coords();
////        Console.WriteLine($"Coords #1 at {p1}");
////        // Output: Coords #1 at (0,0)

////        var p2 = new Coords(5, 3);
////        Console.WriteLine($"Coords #2 at {p2}");
////        // Output: Coords #2 at (5,3)
////    }
////}

////abstract class Shape
////{
////    public const double pi = Math.PI;
////    protected double x, y;

////    public Shape(double x, double y)
////    {
////        this.x = x;
////        this.y = y;
////    }

////    public abstract double Area();
////}

////class Circle : Shape
////{
////    public Circle(double radius)
////        : base(radius, 0)
////    { }

////    public override double Area() => pi * x * x;
////}

////class Cylinder : Circle
////{
////    public Cylinder(double radius, double height)
////        : base(radius)
////    {
////        y = height;
////    }

////    public override double Area() => (2 * base.Area()) + (2 * pi * x * y);
////}

////class Example
////{
////    static void Main()
////    {
////        double radius = 2.5;
////        double height = 3.0;

////        var ring = new Circle(radius);
////        Console.WriteLine($"Area of the circle = {ring.Area():F2}");
////        // Output: Area of the circle = 19.63

////        var tube = new Cylinder(radius, height);
////        Console.WriteLine($"Area of the cylinder = {tube.Area():F2}");
////        // Output: Area of the cylinder = 86.39
////    }
////}

//////----------------------------------------------静态构造函数（C# 编程指南）
////public class program {

////    public class Student {

////        static Student() { //  多次实例化时候，只会实例化一次 
////        }
////        public Student(){
////        }

////    }
////    public static void Main(string[] args) {

////        Student student = new Student();
////        Student student2 = new Student();


////    }

////}

////----------------------------------------------如何编写复制构造函数（C# 编程指南）
//public sealed class Person
//{
//    // Copy constructor.
//    public Person(Person previousPerson)
//    {
//        Name = previousPerson.Name;
//        this.Age = previousPerson.Age;
//    }

//    // Alternate copy constructor calls the instance constructor.
//    //public Person(Person previousPerson)
//    //    : this(previousPerson.Name, previousPerson.Age)
//    //{
//    //}

//    // Instance constructor.
//    public Person(string name, int age)
//    {
//        Name = name;
//        Age = age;
//    }

//    public int Age { get; set; }

//    public string Name { get; set; }

//    public string Details()
//    {
//        return Name + " is " + Age.ToString();
//    }
//}

//class TestPerson
//{
//    static void Main()
//    {
//        // Create a Person object by using the instance constructor.
//        Person person1 = new Person("George", 40);

//        // Create another Person object, copying person1.
//        Person person2 = new Person(person1);

//        // Change each person's age.
//        person1.Age = 39;
//        person2.Age = 41;

//        // Change person2's name.
//        person2.Name = "Charles";

//        // Show details to verify that the name and age fields are distinct.
//        Console.WriteLine(person1.Details());
//        Console.WriteLine(person2.Details());

//        // Keep the console window open in debug mode.
//        Console.WriteLine("Press any key to exit.");
//        Console.ReadKey();
//    }
//}
//// Output:
//// George is 39
//// Charles is 41